<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var poker = [];
    var poker_value = [3,4,5,6,7,8,9,10,'J','Q','K','A',2];
    for(var i= 3; i < 16; i++) {
        for(var j = 1; j < 5; j++){
            var json = {};
            json.num = i;
            json.color = j;
            json.value = poker_value[i-3];
            poker.push(json);
        }
    }
    poker.push({num:16, vaule:'sk'}, {num:17, vaule:'bk'});
    poker.sort(function(){return Math.random() - 0.5});
//    var clientArr = [{poker:[]},{poker:[]},{poker:[]}];
//    var bottomArr =[];
//    poker.sort(function(){return Math.random() - 0.5});
//    for (var i = 0;i < 3;i++){
//        clientArr[i].poker = poker.splice(0,17);
//
//    }
//    bottomArr = poker;
//    clientArr.forEach(function (client,index) {
//        console.log(index,client);
//
//    });
//    function w_paixu(a, b){
//        var temp=a;
//        a=b;
//        b=temp;
//    }
    function sortJson(json){
        for (var i = 0; i < json.length; i++) {
            for (var j = 0; j < json.length-1; j++) {
                if (json[j].num > json[j+1].num) {
                    var temp=json[j];
                    json[j]=json[j+1];
                    json[j+1]=temp;
                }else if(json[j].num == json[j+1].num && json[j].color > json[j+1].color){
                    var temp=json[j];
                    json[j]=json[j+1];
                    json[j+1]=temp;
                }
            }
        }
        return json;
    }

    console.log(sortJson(poker))
</script>
</body>
</html>